package com.alex.seo.app;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import com.alex.seo.contentsource.TestContentSource;
import com.alex.seo.context.AppContext;
import com.alex.seo.service.campaign.CampaignService;
import com.alex.seo.service.campaign.dto.PublishingCampaignDTO;
import com.alex.seo.service.campaign.executor.publishing.TestJobScheduler;
import com.alex.seo.service.site.SiteService;
import com.alex.seo.service.site.dto.WordpressDTO;

public class SeoApp {

	public static void main(String[] args) throws Exception {
		SiteService siteService = AppContext.GET.getBean(SiteService.class);
		CampaignService campaignService = AppContext.GET.getBean(CampaignService.class);
		
		int id1 = siteService.createSite(new WordpressDTO("test", "http://wp.test/", "admin", "123123"));
		int id2 = siteService.createSite(new WordpressDTO("test2", "http://wp.test/", "admin", "123123"));
		int id3 = siteService.createSite(new WordpressDTO("test2", "http://wp.test/", "admin", "123123"));
		
		Set<Integer> siteIds = new HashSet<Integer>();
		siteIds.add(id1);
		siteIds.add(id2);
		
		int groupId = siteService.createGroup("test", siteIds);
		campaignService.createCampaign(new PublishingCampaignDTO("test", Collections.singleton(groupId), Collections.singleton(id3), new TestJobScheduler(), new TestContentSource()));
	}
}
